#!/usr/bin/env python3
#-*- coding:utf-8 -*- 

import matplotlib.pyplot as plt
import numpy as np

ax = plt.subplot(1,1,1)

t = np.arange(0.0, 5.0 ,0.01)

s = np.cos(2 * np.pi * t)
line, = plt.plot(t, s, lw=2)

plt.annotate('local max', xy=(2, 1), xytext=(3, 1.5),
             arrowprops=dict(facecolor='red',shrink=0.05))
plt.ylim(-2, 2) #指定y轴坐标范围
plt.show()

